package com.neusoft.my12306.common.ex;

import com.neusoft.my12306.common.res.CommonResult;
import com.neusoft.my12306.common.res.IResult;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@RestControllerAdvice
@CrossOrigin
@Slf4j
public class ExceptionsHandler {
//    private static final Logger logger = LoggerFactory.getLogger(ExceptionsHandler.class);
//    @ExceptionHandler({Exception.class})
//    public CommonResult arithmeticException(Exception ex) {
//        log.error("发生内部异常：{} ", ex.getMessage(), ex);
//        CommonResult result =new CommonResult(IResult.INTERNALSERVER_ERROR, ex.getMessage() ,null);
//        return  result;
//    }
}
